package com.syedu.day07;

public class TestStudent {
    public static void main(String[] args) {

        Student student1 = new Student("jack", 21);
        Student student2 = new Student("rose", 20);

        /*student1.setName("jack");
        student1.setAge(21);
        student2.setName("rose");
        student2.setAge(20);*/

        //获取属性
        System.out.println(student1.getName());
        System.out.println(student1.getAge());

        //调用方法
        student1.study();
        student2.study();

        //使用数组来保存学生对象
        Student[] students = {student1, student2};

        //遍历数组
        for (Student s : students) {
            System.out.println(s.getName() + "," + s.getAge());
            s.study();
        }
    }
}